package com.jack.payment.i18;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.LocaleResolver;

import java.util.Locale;

public class I18nLocaleResolver implements LocaleResolver {
    @Override
    public Locale resolveLocale(HttpServletRequest request) {
        Locale locale = request.getLocale();
        String language = request.getHeader("language");
//        if (!StrUtil.isEmpty(language)) {
//            LanguageConstant languageConstant = LanguageConstant.systemSupportLanguage(Integer.valueOf(language));
//            locale = new Locale(languageConstant.getLanguage(), languageConstant.getRegion());
//        } else {
//            locale = new Locale("zh", "CN");
//        }
        return locale;
    }

    @Override
    public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) {
    }
}
